import upload from '@/utils/upload'
import request from '@/utils/request'

// 生成页面小程序码
export function genMiniCodeForPage(data) {
  return request({
    url: '/parking/spots/genMiniCodeForPage',
    method: 'get',
    params: data
  })
}


// 查询车位出租列表
export function listSpots(query) {
   return request({
      url: '/parking/spots/list',
      method: 'get',
      params: query
   })
}

// 查询车位出租列表
export function listMineSpots(query) {
   return request({
      url: '/parking/spots/list/mine',
      method: 'get',
      params: query
   })
}

// 查询车位出租详细
export function getSpots(spotId) {
   return request({
      url: '/parking/spots/' + spotId,
      method: 'get'
   })
}

export function addMineSpot(data) {
   return request({
      url: '/parking/spots/mine',
      method: 'post',
      data: data
   })
}

// 修改车位出租
export function updateMineSpot(data) {
   return request({
      url: '/parking/spots/mine',
      method: 'put',
      data: data
   })
}

// 删除车位出租
export function delMineSpot(spotId) {
   return request({
      timeout: 60000,
      url: '/parking/spots/mine/' + spotId,
      method: 'delete'
   })
}

// 上传照片
export function uploadSpotImage(data) {
   return upload({
      url: '/parking/spots/uploadSpotImage',
      filePath: data.filePath
   })
}
